-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
movevm loaderv2 integration #284
Conversation
Caution Review failedThe pull request is closed. 📝 Walkthrough📝 WalkthroughWalkthroughThe pull request introduces several enhancements to the Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Dependency ReviewThe following issues were found:
License Issuesgo.mod
Denied Licenses: GPL-1.0-or-later, LGPL-2.0-or-later OpenSSF Scorecard
Scanned Files
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
🧹 Outside diff range and nitpick comments (2)
x/move/config/config.go (1)
32-33
: LGTM! Functions updated to support new cache capacity fields.The updates to
DefaultMoveConfig
,GetConfig
, andAddConfigFlags
functions are consistent with the new fields and flags. These changes ensure proper configuration and retrieval of the new cache capacities.Consider adding a blank line between the different flag additions in the
AddConfigFlags
function for improved readability:startCmd.Flags().Uint64(flagContractSimulationGasLimit, DefaultContractSimulationGasLimit, "Set the max simulation gas for move contract execution") + startCmd.Flags().Uint64(flagScriptCacheCapacity, DefaultScriptCacheCapacity, "Set the script cache capacity") startCmd.Flags().Uint64(flagModuleCacheCapacity, DefaultModuleCacheCapacity, "Set the module cache capacity")
Also applies to: 41-42, 49-50
x/move/keeper/keeper.go (1)
93-94
: Consider Enhancing the Panic Message for VM Initialization ErrorsCurrently, if
vm.NewVM
returns an error, the code will panic without additional context:if err != nil { panic(err) }While panicking may be acceptable during initialization, providing more context in the panic message can aid in debugging.
Consider updating the panic to include an explanatory message:
if err != nil { - panic(err) + panic(fmt.Sprintf("Failed to initialize VMEngine: %v", err)) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (2)
go.mod
is excluded by!**/*.mod
go.sum
is excluded by!**/*.sum
,!**/*.sum
📒 Files selected for processing (5)
- x/move/config/config.go (2 hunks)
- x/move/keeper/genesis.go (1 hunks)
- x/move/keeper/handler.go (3 hunks)
- x/move/keeper/keeper.go (3 hunks)
- x/move/keeper/vmpool.go (0 hunks)
💤 Files with no reviewable changes (1)
- x/move/keeper/vmpool.go
🧰 Additional context used
🔇 Additional comments (8)
x/move/config/config.go (5)
12-13
: LGTM! Please verify the default cache capacities.The addition of
DefaultScriptCacheCapacity
andDefaultModuleCacheCapacity
constants is consistent with the PR objectives. However, please confirm that these default values (100 and 500 respectively) are appropriate for the system's requirements and expected load.
17-18
: LGTM! New flags are consistent with existing naming conventions.The addition of
flagScriptCacheCapacity
andflagModuleCacheCapacity
is consistent with the PR objectives and follows the existing naming convention. This allows for proper configuration of the new cache capacities.
24-25
: LGTM! New fields added to MoveConfig struct.The addition of
ScriptCacheCapacity
andModuleCacheCapacity
fields to theMoveConfig
struct is consistent with the PR objectives. The use ofuint64
type andmapstructure
tags is appropriate and maintains consistency with the existing structure.
62-65
: LGTM! DefaultConfigTemplate updated with new cache capacity entries.The
DefaultConfigTemplate
has been correctly updated to include entries forscript-cache-capacity
andmodule-cache-capacity
. The new entries follow the same format as the existing ones, maintaining consistency in the configuration template.
Line range hint
1-65
: Overall, the changes in this file look good.The modifications to
x/move/config/config.go
are consistent with the PR objectives of enhancing theMoveConfig
structure. The new constants, flags, and fields for script and module cache capacities have been properly integrated into the existing code. The changes maintain good coding practices and consistency with the existing codebase.A few minor suggestions were made for improvement, but overall, the implementation looks solid.
x/move/keeper/genesis.go (2)
Line range hint
1-214
: Overall impact of the change is minimal and focused.The modification to the
Initialize
method is the only change in this file. TheInitGenesis
andExportGenesis
methods remain untouched, suggesting that the change is self-contained and doesn't require adjustments to the overall genesis state management logic.This focused change aligns well with the PR objective of integrating a new VM loader version, as it simplifies the VM initialization process without affecting other parts of the genesis handling.
50-50
: Approve the simplification of VM initialization.The change simplifies the code by directly calling
k.initiaMoveVM.Initialize
instead of using a function wrapper. This improves readability and potentially reduces function call overhead.However, please consider the following:
- Ensure that
k.initiaMoveVM
is always properly initialized before this method is called.- Verify that no important logic or error handling was lost by removing the previous closure.
- Confirm that this change doesn't affect error propagation or context handling in unexpected ways.
To ensure the change doesn't introduce any regressions, please run the following verification:
x/move/keeper/keeper.go (1)
44-44
:⚠️ Potential issueConfirm Thread Safety of
initiaMoveVM
The
initiaMoveVM
field now holds a single VM instance shared across theKeeper
. Ensure that theVMEngine
implementation is thread-safe and can handle concurrent access without data races or unexpected behavior. Previously, multiple VM instances were managed with a semaphore to control concurrent usage.To verify the thread safety, you can run the following script to identify all usages of
initiaMoveVM
and assess whether they are safe:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* connect movevm with loaderv2 and introduce module & script cache * use cache context before query * disable unstable * update movevm to latest * add toml description --------- Co-authored-by: beer-1 <[email protected]>
* prepare upgrade initiation-2 * fetching code bytes with precompile readlib func * delete existing upgrade handler * dont delete if it is module * add cosmos move * add get&set checksums, genesis import&export module checksums * change checksum func * initialize staking at genesis (#290) * movevm loaderv2 integration (#284) * connect movevm with loaderv2 and introduce module & script cache * use cache context before query * disable unstable * update movevm to latest * add toml description --------- Co-authored-by: beer-1 <[email protected]> * wip * delete keys after iteration * clone key value * fix * reverse iterate vmstore & set keys * final touch * update swagger docs --------- Co-authored-by: beer-1 <[email protected]> Co-authored-by: beer-1 <[email protected]>
No description provided.